import { BasicPageSearchParams } from "/@/api/model/baseModel";
import { defHttp } from '/@/utils/http/axios';


// 商务管理->合同登记接口
enum Api {
  list = '/BusinessContract/list',
  view = '/BusinessContract/view',
  add = '/BusinessContract/add',
  update = '/BusinessContract/update',
  del = '/BusinessContract/del/',
  getAll = '/BusinessContract/getAll',
  getBank = '/BusinessContract/getBank',

  updateConfirm = '/BusinessContract/updateConfirm', //合同确认
  projectView = '/BusinessContract/projectView', //项目详情
  receivedList = '/BusinessFinancialReceived/receivedList', //合同收款列表
  receivedUpdate = '/BusinessFinancialReceived/update', //合同收款
  billAdd = '/BusinessFinancialBill/add', //申请开票
  billUpdate = '/BusinessFinancialBill/update', //申请开票
  billDel = '/BusinessFinancialBill/del/',//申请开票

}


export const list = (params?: any) => {
  const query = params && { pageNum: params.pageNum, pageSize: params.pageSize };
  let entity = params || {};
  if (entity) {
    delete entity['pageNum'];
    delete entity['pageSize'];
  }
  if (entity && !entity['index']) {
    entity['index'] = 0;
  }
  const queryParam = { query, entity } as BasicPageSearchParams<any>;
  return defHttp.post<any>({ url: Api.list, params: queryParam });
};

export const view = (params) => {
  return defHttp.get<any>({ url: Api.view, params });
};

export const getAll = () => {
  return defHttp.get<any>({ url: Api.getAll });
};

export const getBank = (params) => {
  return defHttp.get<any>({ url: Api.getBank, params });
};

export const add = (params) =>
  defHttp.post<any>({ url: Api.add, params });

export const update = (params) =>
  defHttp.post<any>({ url: Api.update, params });

export const del = (id?: number) =>
  defHttp.post<any>({ url: Api.del + id });

export const projectView = (id?: number) => {
  return defHttp.get<any>({ url: Api.projectView + '/' + id });
};

export const updateConfirm = (params) =>
  defHttp.post<any>({ url: Api.updateConfirm, params });

export const receivedUpdate = (params) =>
  defHttp.post<any>({ url: Api.receivedUpdate, params });

export const billAdd = (params) =>
  defHttp.post<any>({ url: Api.billAdd, params });

export const billUpdate = (params) =>
  defHttp.post<any>({ url: Api.billUpdate, params });

export const billDel = (id?: number) =>
  defHttp.post<any>({ url: Api.billDel + id });

export const receivedList = (params) => {
  return defHttp.get<any>({ url: Api.receivedList, params });
};

